<?php

ob_start();
session_start();
//$_SESSION['list_news_list'] = 1;

require("libraries/Mobile_Detect.php");
//Check and set session mobile
if(!isset($_SESSION['mobile'])){
	$detect = new Mobile_Detect;
	if ( $detect->isMobile() ) {
	 	if ( $detect->isMobile() ) {
 			$_SESSION['mobile']=1;
		}
		// Any tablet device.
		if( $detect->isTablet() ){
		 	$_SESSION['mobile']=2;
		}
	}else{
		$_SESSION['mobile']=0;	
	}
}

//Mobile detect
require("libraries/db_record2.php");
require("libraries/config.php");
require("libraries/function.php");
require("libraries/cache.php");
require("libraries/function/user.php");
require("libraries/function/render.php");
require("libraries/function/cache.php");
require("libraries/pagination.php");
require("helpers/number.php");

require("libraries/video/videofactory.php");

if(isset($_GET['module']))
{	$mod=$_GET['module'];
	switch($mod)
		{
		case "user":require("controllers/user/controller.php");
		break;
		case "news":require("controllers/news/controller.php");
		break;
		case "comment":require("controllers/comment/controller.php");
		break;
		case 'ajax': require('controllers/ajax/ajax.php');
		break;
		}
}
else
if(isset($_POST['module']))
{	$mod=$_POST['module'];
	switch($mod)
	{
	case "news":require("controllers/news/controller.php");
	break;				
	case "comment":require("controllers/comment/controller.php");
	break;
	case "user":require("controllers/user/controller.php");
	break;
	
					
	}
}
else
{	
require("controllers/news/list_news.php");
}

if($_GET['act'] != 'ajax'){
loadview("template/footer");
}

ob_end_flush();
?>
